
*******************************************	   
******* Table A3. Econ Shock National Level
*******************************************	   

clear all
clear matrix
set more off

* Data 
use "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/panel_excombatientes.dta", clear 

sort origmun year
collapse (mean) gold_price oro_sin_titulo capturas_MD captu_BACRIM_cesed pobl_tot, by(origmun year)

* National Outcome
gen captures_national= capturas_MD/pobl_tot*1000
gen captu_BACRIM_national= captu_BACRIM_cesed/pobl_tot*1000

* Log prices
gen log_gold_price_national=log(gold_price)

* Economic shock = intensity*price
gen gold_shock_national= oro_sin_titulo*log_gold_price_national

sum gold_shock_national
generate gold_shock_national_r = (gold_shock_national-r(mean))/r(sd)

eststo clear
set more off

reghdfe captures_national gold_shock_national_r, absorb(origmun) cluster(origmun)
estadd local MFE = "$\checkmark$"
summ captures_national if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

reghdfe captures_national gold_shock_national_r, absorb(year origmun) cluster(origmun)
estadd local MFE = "$\checkmark$"
estadd local TFE = "$\checkmark$"
summ captures_national if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

reghdfe captu_BACRIM_national gold_shock_national_r, absorb(origmun) cluster(origmun)
estadd local MFE = "$\checkmark$"
summ captu_BACRIM_national if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

reghdfe captu_BACRIM_national gold_shock_national_r, absorb(year origmun) cluster(origmun)
estadd local MFE = "$\checkmark$"
estadd local TFE = "$\checkmark$"
summ captu_BACRIM_national if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA3.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   stats(meanDep SDDep N MFE TFE, fmt(%12.4fc %12.4fc  %12.0fc %12.0fc %12.0fc) ///
	   label("\small Mean of Outcome" "\small S.D of Outcome" "\small Observations" "\small Municipality FE" "\small Year FE")) ///
	   keep(gold_shock_national_r) ///
	   varlabels(gold_shock_national_r "Municipal Gold Shock") ///
	   ti("Economic Shock National Level") ///	  
	   replace


